REPORT.PRINTER_OVERRIDE Function
Syntax
Arguments
- printername
The printer's name (as it appears in the Control Panel ) followed optionally by "on port:", where port is the port on which you want to print. If Printer_Name is equal to a NULL string (""), then Alpha Anywhere will use the Default Windows printer.
- printeroptions
Optional. A dot variable specifying the new options to set. The options that will be available depend on the printer you select. The following options appear for a Compaq laser printer. For a view of your printer's options:
- 1. Create a new Action Script.
- 2. Select Reports > Print a Layout.
- 3. Display the Options tab.
- 4. Click Override printer settings.
- Option
- Description
- papersize
"Letter", "Legal", "Tabloid", etc.
- orientation
"Portrait" or "Landscape"
- paperlength
A positive number (e.g. 11).
- paperwidth
A positive number (e.g. 8.5).
- scale
A positive number
- copies
An integer number greater than or equal to 1.
- quality
"High", "Medium", "Low", or "Draft".
- color
"Color" or "Monochrome".
- duplex
"Simplex", "Horizontal", "Vertical"
- truetype
"Bitmap", "Download", "Substitute"
- collate
.T. or .F.
- defaultsource
"Automatically Select", "Manual Paper Feed", "Tray 1", etc.
- saveoldoptions
Optional. A dot variable to hold the previous set of options.
Description
Override the Report printer.
Discussion
The REPORT.PRINTER_OVERRIDE() method sets the printer to Printer_Name for all subsequent print operations. Alpha Anywhere will use Printer_Name regardless of whether the layout specifies an explicit printer name, or the default printer. In addition, Alpha Anywhere will not display the Printer Selection dialog box even if you checked the "Show printer setup on print" check box in the layout. Last_Printer is the name of the printer that Alpha Anywhere was previously set to use. This allows you to restore the previously set printer driver. Printer_Name should be the printer's name (as it appears in the Control Panel ) followed optionally by "on port:", where port is the port on which you want to print. For example:
:report.printer_override("HPLaserJet 6 on LPT1:") :report.printer_override("EPSON on COM1:") :report.printer_override("Generic on FILE:")
If you omit the port, Alpha Anywhere will try to infer the port from the printer definition.
Example
Set the printer, prints a report, then restores the printer.
last_printer = :report.printer_override("HPLaserJet 4P") :report.print("invoices") :report.printer_override(last_printer)
Set printer to a network printer on the server called ATLANTIC.
last_printer = :report.printer_override("\\ATLANTIC\HPLaserJet 4P") :report.print("invoices") :report.printer_override(last_printer)
This example shows how to override certain printer properties.
query.filter = "" query.order = "" delete options dim options as P dim options_text as C ' Before you can initialize 'options' using the property_from_string() function at least one dot variable must exist. therefore, create a dummy variable. options.dummy = 1 options_text = <<%str% %str% ' Create a dot variable from options_text. ' The dot variable contains the printer properties to be overridden property_from_string(options, options_text) ' Now you can delete the dummy variable delete option.dummy ' oldOptions will store the current printer options, so that we can restore them. delete oldOptions dim oldOptions as P oldOptions.dummy = 1 ' Set the printer override settings. old_printer_name = report.Printer_override("WebWorks Rasterizer on LPT1:", options, oldOptions) ' Delete the dummy variable delete oldOptions.dummy :Report.Print("report1", query.filter, query.order) ' Now restore the original printer settings report.printer_override(old_printer_name, oldOptions)
See Also